const path = require('path')
const cwd = process.cwd()
const webpack = require('webpack')
const getEntry = require('./getEntry.js')


module.exports = function (){
    var chunksList = Object.keys(getEntry(path.resolve(cwd, 'src/js/page/**/*.js')))
    return new webpack.optimize.CommonsChunkPlugin({
        name: 'page/vendors',
        chunks: chunksList,
        minChunks: 2
    })
}